#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 1e6 + 10, INF = 0x3f3f3f3f;

void solve()
{
    int n, m;
    while (cin >> n >> m) {
        vector<vector<int>> c(m + 1);
        vector<int> ans;
        set<int> s;
        bool f = true;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                int x;
                cin >> x;
                c[j].push_back(x);
            }
        }
        for (int i = 1; i <= m; i++)
            s.insert(i);
        int l = 0, cnt = 0;
        while (true) {
            vector<int> t;
            for (auto i : s) {
                if (is_sorted(c[i].begin() + l, c[i].end())) {
                    ans.push_back(i);
                    t.push_back(i);
                }
            }
            for (auto i : t) s.erase(i);
            if (cnt == ans.size()) {
                f = false;
                break;
            } else
                cnt = ans.size();
            if (ans.size() == m)
                break;
            int now = ans.back();
            int k = l;
            for (; k < n; k++) {
                if (c[now][k] == c[now][k + 1]) {
                    l = k;
                    break;
                }
            }
            if (k == n) {
                for (auto i : s)
                    ans.push_back(i);
                break;
            }
        }

        if (f)
            for (auto i : ans)
                cout << i << " ";
        else
            cout << -1;
        cout << "\n";
    }
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    // cin>>T;
    for (int i = 1; i <= T; i++) {
        solve();
    }
}